<?
$pagecount_1=10;

function check_customer_session()
{
	ob_start();
	session_start();

	if(!isset($_SESSION['ep_email']) || !isset($_SESSION['ep_customer_id']))
	{
		header("location:login.php");
	}
}

$tomorrow  = mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"));
$lastmonth = mktime(0, 0, 0, date("m")-1, date("d"),   date("Y"));
$today = date("j-F-Y");

//paging function script start here
//b - start number of sql query -limit 0, 
//tot - $cnt = mysql_num_rows($rs)
//$qrystr="&sortBy=$sortBy&dir=$dir&city=".$_REQUEST['city']."&location=".$_REQUEST['location']
// $class -"link-pagination" - this is common
//$cnt - sql query end limit $b, $cnt
			 
			 /*sample code of pagination
<? if ($cnt > $pagecount_1) {?>
				<tr>
					<td class="mesg" colspan="6">
					<?
						$qrystr="&sortBy=$sortBy&dir=$dir&city=".$_REQUEST['city']."&location=".$_REQUEST['location'];
						displayPageNo($b,$cnt,$qrystr,"link-pagination",$pagecount_1);
					?>
					</td>justify-txt-11
				</tr>
				<? } ?>
				
				 */
function displayPageNo($b,$tot,$qrystr,$class,$cnt)

{

	print "<center><table width=100% ><tr><td align=center class='form-txt'><hr color=#660066 /><span class=\"mediumblueboldlink\">Page : &nbsp;<span>";

	$i=0;

	while ($i<$tot/$cnt)

	{

	 	$c=$i+1;

		if ($i==$b/$cnt)

		{

			echo "<span class=\"mediumredbold\">$c&nbsp;&nbsp;<span>";

		}

		else

		{

			$b2=$i*$cnt;

			if ($qrystr!="")

			{

				$q="&$qrystr";

			}

			echo "<a href=\"$PHP_SELF?1=1$q&b=$b2\" class='HomeLink1'>$c</a>&nbsp;&nbsp;";

			if($i%19==0) echo "<BR>";

		}

		$i+=1;

	}

	print "</td></tr></table></center>";

}
//paging function script end here

function profile_permalink($cid,$name,$surname) {
	$clean_name = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $name);
	$clean_name = strtolower(trim($clean_name, '-'));
        $clean_surname = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $surname);
	$clean_surname = strtolower(trim($clean_surname, '-'));
	$clean_url = preg_replace("/[\/_|+ -]+/", '-', $clean_name."-".$clean_surname);
        $clean_url_full = "/profile/".$cid."/".$clean_url.".html";
	return $clean_url_full;
}


?>